<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title></title>
<link href="../../css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../../js/main.js"></script>
<script type="text/javascript">
	function goBack(){
			location.href="<%=request.getContextPath() %>/NewsServlet?param=selectAll";
		}
		
	function titles(){
	 
	var title=document.getElementById("titleName").value;
	var regC=/^\s{0,}$/;//\s空白字符
	if(regC.test(title)||title==null||title==""){
		//alert("标题不能为空，请输入！");
			document.getElementById("name").style.color="red";
		document.getElementById("name").innerHTML="标题不能为空";
		return false;
		
	}
	document.getElementById("name").style.color="green";
	document.getElementById("name").innerHTML="√";
 
	return true;
	
	}	
	
	function neirong(){
	var neirong=document.getElementById("neirong").value;
	var regT=/^\s{0,}$/;//\s空白字符
	if(regT.test(neirong)||neirong==null||neirong==""){
	
			document.getElementById("nei").style.color="red";
		document.getElementById("nei").innerHTML="内容不能是空,请输入内容！";
		return false;
			alert("请将表填完整!∩_∩");
			}	
	document.getElementById("nei").style.color="green";
	document.getElementById("nei").innerHTML="√";
	return true;
	}
function sub(){
	return neirong()&&titles();
}		
		
		
</script>
</head>
<body>
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="3">
  <tr>
    <td style="height:25px; background-color:#f3f3f3; font-weight:bold" valign="top">
    &nbsp;&nbsp;&nbsp;&nbsp;当前位置：
    <img src="../../images/arrow.gif" align="absmiddle">&nbsp;&nbsp;soda创业教育平台&nbsp;&nbsp;
    <img src="../../images/arrow.gif" align="absmiddle">&nbsp;&nbsp;后台管理&nbsp;&nbsp;
    <img src="../../images/arrow.gif" align="absmiddle">&nbsp;&nbsp;新闻管理</td>
  </tr>
  <tr>
    <td style="height:34px; background-image:url(../../images/main_header.gif); border-bottom:1px solid #cfd8e0; padding:0px">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="20" height="34"><img src="../../images/main_headerL.gif" width="20" height="34"></td>
          <td style="color:#90c8e8;"><img src="../../images/icon_card.gif" width="16" height="16" align="absmiddle">&nbsp;&nbsp;
          <strong><a href="index.jsp">新闻管理 </a> &nbsp;&nbsp;》》》	添加新闻</strong></td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td height="100%" valign="top">
    <div style="overflow:auto;height:100%; width:100%">
    <form action="<%=request.getContextPath()%>/NewsServlet" method="post" onsubmit="return sub()">
    
    <input type="hidden" name="param" value="add"/>
      <table width="100%" border="0" cellpadding="3" cellspacing="1" class="table1">
        <tr>
        	<td style="text-align:right" style="width:300px ">标题</td>
            <td><input type="text" name="Name" id="titleName"onblur="titles()"/><span id="name"></span></td>
            
        </tr>
        <tr>
        	<td style="text-align:right" style="width:300px">作者</td>
            <td><input type="text" name="Author" value="${sessionScope.user.useLoginName }" readonly="readonly"></td>
         
        </tr>
        <tr>
        	<td style="text-align:right" style="width:300px">访问量</td>
            <td><input type="text" name="count" value="0" readonly="readonly"></td>
       		 
        </tr>
        <tr>
        	<td style="text-align:right">是否推荐</td>
            <td><input type="radio" name="recommend" value="1" checked="checked">是&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="recommend" value="0">否</td>
       	
        </tr>
        <tr>
        	<td style="text-align:right">内容</td>
            <td><textarea rows="10" cols="42" name="neirong" id="neirong" onblur="neirong()"></textarea><span id="nei"></span></td>
       	 
        </tr>
        <tr>
        	<td style="text-align:right"></td>
            <td><input type="submit"value="提交"> <input type="button" value="返回" onClick="Javascript:goBack()"></td>
        </tr>
      </table>
      </form>
    </div>
  </td>
  </tr>
</table>
</body>
</html>